/*
* Poppy Game Engine - https://pgetemplate.googlecode.com/svn/
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* Copyright (c) 2008 Poppy
*/

#pragma once

#include "RendererDefines.h"
#include "SystemDefines.h"
#include "RendererExportSymbol.h"
#include "Structs.h"
#include "CPSPDriver.h"

namespace PGERenderer
{

	struct FillablePoint
	{
		FillablePoint(int x, int y, unsigned int colr) : point(x, y)
		{
			color = colr;
		};
		PGEMath::SPOINT_I point;
		DWORD color;
	};

	struct PointList
	{
		PointList(PGEMath::SPOINT_I* ppoi, DWORD col, DWORD cou)
		{
			ppoint = ppoi;
			color = col;
			count = cou;
		}
		PGEMath::SPOINT_I* ppoint;
		DWORD color;
		DWORD count;
	};

	struct FillableLine
	{
		FillableLine(int x1, int y1, int x2, int y2, unsigned int colr) : point1(x1, y1), point2(x2, y2)
		{
			color = colr;
		};
		PGEMath::SPOINT_I point1;
		PGEMath::SPOINT_I point2;
		DWORD color;
	};

	struct FillableRect
	{
		FillableRect( int x, int y, int w, int h, unsigned int colr ) : rect(x, y, w, h)
		{
			color = colr;
		}

		PGEMath::SRECT_I rect;
		DWORD color;
	};

	class PGERENDERER_API CRenderer : public CPSPDriver
	{
	public:

		void DrawPointList( FillablePoint* ppoint, DWORD count );
		void DrawLine( FillableLine& line );
		void DrawLineList( FillableLine* pline, DWORD count );
		void DrawLineStrip( PointList& points );
		void DrawRect( PGEMath::SRECT_I& rect, DWORD color );
		void DrawRectList( FillableRect* pRects, DWORD count );
		void FillRect( PGEMath::SRECT_I& rect, DWORD color );
		void FillRectList( FillableRect* pRects, DWORD count );
		void DrawPolygon( PointList& points );
		void FillPolygon( PointList& points );

		static CRenderer* GetInstance();

		static void Release();

	protected:

		CRenderer() {};

		virtual ~CRenderer() {};

	};

}
